package formbeans;

import java.util.ArrayList;
import java.util.List;

import org.mybeans.form.FormBean;

public class BinaryForm extends FormBean {

	private String question;
	private String dynetmlAttr;
	private String className;
	private String yes;
	private String no;
	
	public String getQuestion() {
		return question;
	}
	public String getDynetmlAttr() {
		return dynetmlAttr;
	}
	public String getClassName() {
		return className;
	}
	public String getYes() {
		return yes;
	}
	public String getNo() {
		return no;
	}

	public void setQuestion(String question) {
		this.question = trimAndConvert(question,"<>\"");
	}
	public void setDynetmlAttr(String dynetmlAttr) {
		this.dynetmlAttr = trimAndConvert(dynetmlAttr, "<>\"");
	}
	public void setClassName(String className) {
		this.className = className;
	}
	public void setYes(String yes) {
		this.yes = trimAndConvert(yes, "<>\"");
	}
	public void setNo(String no) {
		this.no = trimAndConvert(no, "<>\"");
	}
	
	public List<String> checkBinaryFormErrors(){
		List<String> errors = new ArrayList<String>();
		
		if(question == null || question.length() == 0){
			errors.add("Please enter a question");
		}
		if(dynetmlAttr == null || dynetmlAttr.length() == 0){
			errors.add("Please enter description for \"dynetml attribute identifier\"");
		}
		if(yes == null || yes.length() == 0){
			errors.add("Please enter description for \"Yes\"");
		}
		if(no == null || no.length() == 0){
			errors.add("Please enter description for \"No\"");
		}
		
		return errors;
	}
}